package com.example.base.demo.i18n;

import lombok.Data;

/**
 * @author TangDan
 * @version 1.0
 * @since 2023/3/7
 */
@Data
public class Result<T> {

    private String code;

    private String msg;

    private T data;

    public static Result success() {
        Result result = new Result<>();
        result.setCode("0");
        // 响应消息国际化处理返回
        result.setMsg(MessageSourceUtils.getMsg("msg"));
        return result;
    }

    public static Result error(String code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(MessageSourceUtils.getMsg("msg"));
        return result;
    }
}
